home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / os2 / lxlt121.zip / lxLite / install.cmd < prev    next >
OS/2 REXX Batch file  |  1997-06-07  |  12KB  |  354 lines

  1. /***********************************/
  2. /* lxLite installation script file */
  3. /***********************************/
  4.  '@echo off'
  5.  'cls'
  6.  signal ON Halt name BreakHandler;
  7.  call rxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  8.  call SysLoadFuncs
  9.  
  10.  call SetColor Cyan
  11.  say Center("═══════ FRIENDS software presents ═══════", 78)
  12.  call SetColor White
  13.  say Center("╖  \//        An  OS/2 executables packer", 78)
  14.  say Center("╜─╜//\  ╖     Lots  of  features, maximal", 78)
  15.  call SetColor Gray
  16.  say Center("  //╖  ╖╫─╓─╖ compression, nice interface", 78)
  17.  call SetColor DGray
  18.  say Center(" // ╜─╜╨╙─╙── ·F·R·E·E· ·S·O F·T·W·A·R·E·", 78)
  19.  call SetColor Cyan
  20.  say Center("═════════════════════════════════════════", 78)
  21.  version = SysOS2Ver()
  22.  parse value version with hiver "." lover
  23.  if (hiver = 2) & (lover > 11)
  24.   then do
  25.         hiver = lover %  10;
  26.         lover = lover // 10;
  27.        end
  28.  call SetColor LBlue
  29.  say Center("OS/2 version "hiver"."lover" detected", 78)
  30.  
  31.  call SetColor White
  32.  say copies('*', 78)
  33.  call SetColor Yellow
  34.  say "Please note that documentation in HTML format requires a filesystem"
  35.  say "supporting long filenames. If you try to install documentation on a FAT"
  36.  say "drive, you will hear some beeps during installation (XCOPY beeps)."
  37.  say "However, the INF version of documentation will be readable."
  38.  call SetColor Green
  39.  say "Please enter the destination directory for program, ex: C:\OS2\APPS\LXLITE:"
  40.  call SetColor LGreen
  41.  do until (destDir <> '')
  42.   pull destDir
  43.  end;
  44.  if (length(destDir) > 3) & (pos(right(destDir, 1), "\/") > 0)
  45.   then destDir = left(destDir, length(DestDir) - 1);
  46.  do while stream(destDir,"c","query datetime") = ""
  47.   QueryCreate = Ask("The directory you specified does not exist. Create it? (Y/N)", "YN")
  48.   select
  49.    when QueryCreate = "Y"
  50.     then 'mkDir 'destDir' 1>nul 2>nul'
  51.    otherwise
  52.     say "Aborting..."
  53.     exit
  54.   end
  55.  end
  56.  call SetColor Yellow
  57.  say "lxLite utility pack is a set of tiny utilites handy for command-line"
  58.  say "usage. It contains: noEA, a utility for removing extended attributes"
  59.  say "from a file; unLock, a utility that can unlock executable modules"
  60.  say "that are in use (loaded); sysIcons, a utility that allows"
  61.  say "changing/editing of mouse and system pointers and chCase, which"
  62.  say "allow batch case converts of filename/directory names"
  63.  QueryUtility = (Ask("Install lxLite utility pack? (Y/N)", "YN") = "Y");
  64.  call SetColor Yellow
  65.  say "lxLite resources is a set of files that contain all text resources"
  66.  say "of lxLite. It contains all messages and all API functions known"
  67.  say "by name by lxLite. If you want to change lxLite`s messages or to"
  68.  say "add your own APIs, you can use provided sources."
  69.  QueryTextRes = (Ask("Install lxLite text resources? (Y/N)", "YN") = "Y");
  70.  call SetColor Yellow
  71.  say "lxLite documentation is provided in two formats: .HTML and"
  72.  say "in standard OS/2 .INF book format"
  73.  QueryDoc = (Ask("Install lxLite documentation? (Y/N)", "YN") = "Y");
  74.  call SetColor Yellow
  75.  say "Installation program can create a folder with all installed"
  76.  say "stuff onto your OS/2 desktop"
  77.  QueryFolder = (Ask("Create lxLite folder? (Y/N)", "YN") = "Y");
  78.  
  79.  call SetColor White
  80.  say copies('*', 78)
  81.  
  82.  call SetColor Yellow
  83.  if (hiver >= 3)                  /* Repack using Lempel-Ziv for OS/2 v>=2.20 */
  84.   then do
  85.         say "Please wait, repacking lxLite using advanced compression method"
  86.         say "Supported by OS/2 2.99 and above (Warp)"
  87.         'lxLite /yur lxLite.exe'
  88.         'del lxLite2x.cfg 1>nul 2>nul'
  89.        end
  90.   else do
  91.         say "The installed version of OS/2 does not support Lempel-Ziv compression"
  92.     'lxLite /x unLock.exe noEA.exe SysIcons.exe chCase.exe'
  93.         'del lxLite.cfg 1>nul 2>nul'
  94.         'ren lxLite2x.cfg lxLite.cfg 1>nul 2>nul'
  95.        end
  96.  
  97.  call SetColor White
  98.  say copies('*', 78)
  99.  
  100.  if QueryFolder
  101.   then do
  102.         rc = SysCreateObject('WPFolder', 'lxLite', '<WP_DESKTOP>', ,
  103.              'ICONFILE='directory()'\lxlite_f.ico;OBJECTID=<LXLITE_FOLDER>;'||,
  104.              'ICONVIEWPOS=30,70,40,18;ICONVIEW=FLOWED;'||,
  105.              'BACKGROUND='directory()'\doc\img\texture6.gif,T;', 'R');
  106.         rc = SysSetObjectData('<LXLITE_FOLDER>', 'OPEN=DEFAULT');
  107.        end;
  108.  
  109.  call CopyFile "lxLite.exe"
  110.  call CopyFile "lxLite.cfg"
  111.  call CopyFile "stub_min.bin"
  112.  call CopyFile "stub_vdm.bin"
  113.  if QueryDoc
  114.   then do
  115.         call CopyDir  "doc"
  116.         call wpsCreate destDir'\doc\lxLite.inf';
  117.        end;
  118.  if QueryUtility
  119.   then do
  120.     call CopyFile "noEA.exe"
  121.     call CopyFile "chCase.exe"
  122.     call CopyFile "unLock.exe"
  123.     call CopyFile "SysIcons.exe"
  124.     call CopyDir  "AndyPtrs"
  125.     call CopyDir  "AndyB&W"
  126.     call CopyDir  "WGloves"
  127.        end;
  128.  if QueryTextRes
  129.   then do
  130.     call CopyDir  "API"
  131.         call wpsCreate destDir'\api';
  132.        end;
  133.  rc = SysSetObjectData('<LXLITE_FOLDER>', 'BACKGROUND='destDir||'\doc\img\texture6.gif,T');
  134.  
  135.  call SetColor White
  136.  say copies('*', 78)
  137.  call SetColor LRed
  138.  say "-- CAUTION ---- CAUTION ---- CAUTION ---- CAUTION ---- CAUTION ---- CAUTION --"
  139.  call SetColor Yellow
  140.  say Center("If you`re a previous lxLite user please note that in versions above 1.1.5", 78);
  141.  say Center("command-line switches has been changed. I STRONGLY suggest you to browse", 78);
  142.  say Center("through WHATSNEW file (especially the section regarding version 1.1.7),", 78);
  143.  say Center("or at least to run lxLite /? and see what`s changed", 78);
  144.  
  145.  call SetColor White
  146.  say Center("***", 78);
  147.  call SetColor Yellow
  148.  say Center("Note also a new lxLite feature: The ability to convert NE files into LX", 78);
  149.  say Center("then to compress them. This is a tricky technology that does not work in", 78);
  150.  say Center("all cases: for executables and dynamic-link libraries it works in 99% cases,", 78);
  151.  say Center("but not for the device drivers (.ADD, .FLT, .DMD etc). During testing I`ve", 78);
  152.  say Center("found that some Warp 4.0 drivers does not convert correctly, namely", 78);
  153.  say Center("RESOURCE.SYS, OS2CDROM.DMD, ESS1688.SYS and some others. For this reason", 78);
  154.  say Center("by default NE conversion is disabled. To enable it, please uncomment the", 78);
  155.  say Center("[pdd] configuration section in lxLite.cfg file and add an appropiate /N", 78);
  156.  say Center("switch (I recommend /N+BLR-) to the [default] section.", 78);
  157.  if QueryUtility
  158.   then do
  159.         call SetColor White
  160.         say Center("***", 78);
  161.         call SetColor Yellow
  162.         say Center("Note that in some conditions chCase can damage file names. Please test", 78);
  163.         say Center("first chCase in a separate directory: especially on non-English characters", 78);
  164.         say Center("This can happen because of incorrect case-conversion tables in COUNTRY.SYS", 78);
  165.         call SetColor LRed
  166.        end;
  167.  call SetColor LRed
  168.  say "-- CAUTION ---- CAUTION ---- CAUTION ---- CAUTION ---- CAUTION ---- CAUTION --"
  169.  if Ask("Installation complete. Do you want to read the WHATSNEW file now?", "YN") = "Y"
  170.   then do
  171.         call SetColor Cyan
  172.         'cls'
  173.         'call cmd /c type doc\whatsnew.txt | more'
  174.         Ask(d2c(13)"Press Space to continue", " ")
  175.     'cls'
  176.        end
  177.  if Ask("Do you wish to clean the install source directory? (Y/N)", "YN") = "Y"
  178.   then do
  179.         call SetColor Yellow
  180.         say "Please wait, cleaning up ..."
  181.         'del lxLite??.* 1>nul 2>nul'
  182.         'del noEA*.* 1>nul 2>nul'
  183.         'del chCase*.* 1>nul 2>nul'
  184.         'del unLock*.* 1>nul 2>nul'
  185.         'del SysIcons*.* 1>nul 2>nul'
  186.         'del lxUtil*.* 1>nul 2>nul'
  187.         'del stub_*.* 1>nul 2>nul'
  188.         'del whatsnew 1>nul 2>nul'
  189.         'del file_id.diz 1>nul 2>nul'
  190.         'echo Y | del "doc\img" 1>nul 2>nul'
  191.         'rmdir "doc\img"'
  192.         'echo Y | del "doc" 1>nul 2>nul'
  193.         'rmdir "doc"'
  194.         'echo Y | del "AndyB&W" 1>nul 2>nul'
  195.         'rmdir "AndyB&W"'
  196.         'echo Y | del "AndyPtrs" 1>nul 2>nul'
  197.         'rmdir "AndyPtrs"'
  198.         'echo Y | del "WGloves" 1>nul 2>nul'
  199.         'rmdir "WGloves"'
  200.         'echo Y | del "API" 1>nul 2>nul'
  201.         'rmdir "API"'
  202.         'attrib -r install.cmd 1>nul 2>nul'
  203.         'del install.cmd 1>nul 2>nul'
  204.        end
  205.  'cls'
  206.  call SetColor White
  207.  say Center("Just another fine product from", 78)
  208.  call SetColor Yellow
  209.  say Center("╖──────────────╖──╖", 78)
  210.  say Center("║─╖╖─╖╖╓─╖╖─╖╓─╢╓──", 78)
  211.  say Center("╜  ╜  ╨╙──╜ ╙╙─╙──╜", 78)
  212.  call SetColor Red
  213.  say Center("s·o·f·t·w·a·r·e", 78)
  214.  call SetColor Green
  215.  say Center("To contact me, write to: Andrew Zabolotny, 2:5030/84.5@FIDOnet", 78)
  216.  say Center("                 e-mail: bit@freya.etu.ru                     ", 78)
  217.  call SetColor Gray
  218. exit
  219.  
  220. BreakHandler:
  221.  call SetColor Red
  222.  say d2c(13)Center("·-= Installation procedure aborted =-·", 78)
  223.  call SetColor Gray
  224. exit 1
  225.  
  226. CopyFile:
  227.  parse arg fName dPath
  228.  call SetColor Cyan
  229.  say "Copying "fName" -> "destDir||dPath"\"fName
  230.  'copy 'fName destDir||dPath' 1>nul 2>nul'
  231.  call wpsCreate destDir||dPath'\'||fName;
  232. return;
  233.  
  234. wpsCreate:
  235.  parse arg fName
  236.  if \QueryFolder then return;
  237.  select
  238.   when (Pos('.EXE', Translate(fName)) > 0)
  239.    then do
  240.          progType = 'WPProgram';
  241.          progSetup = 'EXENAME='fName';PARAMETERS="%*"';
  242.          progTitle = getTitle(fName);
  243.          progIcon = progTitle||'.ico';
  244.         end;
  245.   when (Pos('.INF', Translate(fName)) > 0)
  246.    then do
  247.          progType = 'WPProgram';
  248.          progSetup = 'EXENAME=VIEW.EXE;PARAMETERS='fName;
  249.          progTitle = getINFtitle(fName);
  250.          progIcon = '';
  251.         end;
  252.   when (Pos('.CFG', Translate(fName)) > 0)
  253.    then do
  254.          progType = 'WPShadow';
  255.          progSetup = 'SHADOWID='fName;
  256.          progTitle = getTitle(fName)||'^configuration file';
  257.          progIcon = '';
  258.         end;
  259.   when (Pos('\API', Translate(fName)) > 0)
  260.    then do
  261.          progType = 'WPShadow';
  262.          progSetup = 'SHADOWID='fName;
  263.          progIcon = '';
  264.         end;
  265.   otherwise return;
  266.  end;
  267.  
  268.  if length(progIcon) > 0 then progIcon = 'ICONFILE='progIcon;
  269.  rc = SysCreateObject(progType, progTitle, '<LXLITE_FOLDER>', progSetup';'progIcon, 'R');
  270. return;
  271.  
  272. CopyDir:
  273.  parse arg dName
  274.  call SetColor Cyan
  275.  say "Copying "dName"\ -> "destDir"\"dName"\"
  276.  'xcopy /s /e "'dName'" "'destDir'\'dName'"\ 1>nul 2>nul'
  277. return
  278.  
  279. Ask:
  280.  parse arg Question,Reply;
  281.  call SetColor Green
  282.  rc = charOut(, Question)
  283.  call SetColor LGreen
  284.  do until Pos(Answer, Reply) \= 0
  285.   KeyIn = SysGetKey("noecho")
  286.   parse upper var KeyIn Answer
  287.  end
  288.  say Answer;
  289. return Answer;
  290.  
  291. lowStr: procedure
  292.  arg S;
  293. return translate(S, xRange('a','z'), xRange('A','Z'));
  294.  
  295. getTitle: procedure
  296.  arg fName
  297.  __S = fileSpec('name', fName);
  298.  if pos('.', __S) > 0
  299.   then __S = subStr(__S, 1, pos('.', __S)-1);
  300. return substr(__S, 1, 1)||lowStr(substr(__S, 2))
  301.  
  302. getINFtitle: procedure;
  303.  arg fName;
  304.  Title = strip(charIn(fName, 108, 48), 'Trailing', d2c(0));
  305.  if Title = '' then Title = getTitle(fName);
  306. return Title;
  307.  
  308. SetColor:
  309.  procedure expose break;
  310.  arg Col;
  311.  Col = ColorNo(Col);
  312.  
  313.  if Col = -1 then return -1;
  314.  if Col > 7
  315.   then Col = '1;3'Col-8;
  316.   else Col = '0;3'Col;
  317.  call charOut ,d2c(27)'['Col'm';
  318. return 0;
  319.  
  320. ColorNo:
  321.  procedure expose break;
  322.  arg ColName;
  323.  if Substr(ColName, 1, 1) = 'L'
  324.   then do
  325.         ColName = right(ColName, length(ColName) - 1);
  326.         Light = 8;
  327.        end
  328.   else Light = 0;
  329.  select
  330.   when Abbrev('BLACK', ColName, 3)
  331.    then return Light + 0;
  332.   when Abbrev('BLUE', ColName, 3)
  333.    then return Light + 4;
  334.   when Abbrev('GREEN', ColName, 3)
  335.    then return Light + 2;
  336.   when Abbrev('CYAN', ColName, 3)
  337.    then return Light + 6;
  338.   when Abbrev('RED', ColName, 3)
  339.    then return Light + 1;
  340.   when Abbrev('MAGENTA', ColName, 3)
  341.    then return Light + 5;
  342.   when Abbrev('BROWN', ColName, 3)
  343.    then return Light + 3;
  344.   when Abbrev('GRAY', ColName, 3)
  345.    then return Light + 7;
  346.   when Abbrev('DGRAY', ColName, 3)
  347.    then return 8;
  348.   when Abbrev('YELLOW', ColName, 3)
  349.    then return 11;
  350.   when Abbrev('WHITE', ColName, 3)
  351.    then return 15;
  352.  end;
  353. return -1;
  354.